#!/bin/bash

set -xe

# 导出前端资源文件

# 前端静态文件存放的位置
readonly MS_BASE=/opt/metersphere
readonly GATEWAY_OEM=${MS_BASE}/gateway-oem
readonly TAG=v2.10.20-lts
readonly DOCKER_IMG=registry.cn-qingdao.aliyuncs.com/metersphere/gateway:v2.10.20-lts

# 如果目录已经存在, 就直接报错
if [ -d ${GATEWAY_OEM}/static ]; then
  echo "${GATEWAY_OEM}/static 目录已存在!"
  exit 1
fi
mkdir -pv ${GATEWAY_OEM}
docker run -d -v ${GATEWAY_OEM}:/gateway-oem ${DOCKER_IMG} cp -rf /app/static/ /gateway-oem
